package com.mad.base.manager;

import java.util.ArrayList;

import com.mad.base.objects.GameObject;
import com.mad.base.objects.grid.EChangeableFieldAttribute;
import com.mad.base.objects.grid.Grid;
import com.mad.base.objects.grid.GridField;
import com.mad.base.objects.grid.IChangeableFieldAttributes;
import com.mad.base.objects.grid.FieldCoverer;
import com.mad.base.system.EDirection;
import com.mad.base.system.ID;

public class GridManager extends SubManager {

	private Grid grid ; 
	
	public GridManager(Manager parentManager) {
		super(parentManager);
	}
	
	public GridField getFieldByID(ID id){
	    return this.grid.getFieldByID( id ); 
	}

    public ArrayList<ID> getFieldsByAttributes(EChangeableFieldAttribute fieldAttr){
        return this.grid.getFieldsByAttributes( fieldAttr ); 
    }
    
	public boolean canAddShipToField(ID bowID, EDirection dir, int shipLength){
	    return this.grid.canAddShipToField( bowID, dir, shipLength ); 
	}
	
	public void addShipToField(ID bowID, EDirection dir, int shipLength){
	    this.grid.addShipToField(bowID, dir, shipLength); 
	}
	
	@Override
	public void init(Object o) {
		this.grid = new Grid(GameManager.GRID_WIDTH, GameManager.GRID_HEIGHT); 
		System.out.println(grid);
	}

	@Override
	public void exit(Object o) {

	}

	@Override
	public void update(Object o) {

	}

}
